package cn.tedu.store.config.util;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStreamReader;

public class RequestUtils {
    public static JSONObject requestJsonString(HttpServletRequest request) throws IOException {
        InputStreamReader isr = new InputStreamReader(request.getInputStream(),"utf-8");
        String result = "";
        int respInt = isr.read();
        while(respInt!=-1) {
            result +=(char)respInt;
            respInt = isr.read();
        }
        JSONObject jsonResult = JSONObject.parseObject(result);
        return jsonResult;
    }}
